﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WinHBM.Utils
{
    public class UtilDict
    {

        public static Dictionary<K,V> make<K,V>(params Object[] objects)
        {
            if((objects.Count() % 2) != 0)
            {
                throw new ArgumentException("参数数量必须是2的倍数");
            }

            Dictionary<K, V> dict = new Dictionary<K, V>();
            for (int i = 0; i < objects.Count(); i=i+2)
            {
                dict.Add((K)objects[i], (V)objects[i + 1]);
            }

            return dict;
        }

    }
}
